﻿using UnityEngine;
using System.Collections;

public class Shooter : MonoBehaviour {

	public GameObject projectilePrefab;
	public Transform projectileExit;
	public bool manual = false;
	
	void Update () 
	{
		if (manual && Input.GetKeyDown(KeyCode.A))
		{
			Shoot (rigidbody.velocity);
		}
	}

	public void Shoot(Vector3 parentSpeed)
	{
		GameObject go = GameObject.Instantiate(projectilePrefab, projectileExit.position, projectileExit.rotation) as GameObject;
		go.GetComponent<Projectile>().ShootProjectile(parentSpeed);
	}
}
